var page = sm("do_Page");
var root = ui("$");
var nf = sm("do_Notification");
// animateyes open位置
var animyes = mm("do_Animator");
var propsyes1 = {
	x : 37
};
animyes.append(120, propsyes1, "EaseIn");
// animateyes close位置
var animno = mm("do_Animator");
var propsno = {
	x : 7
};
animno.append(120, propsno, "EaseIn");
// animategreen 绿色
var animcoloryes = mm("do_Animator");
var propscoloryes = {
	bgColor : "FF7E00FF"
};
animcoloryes.append(120, propscoloryes, "EaseIn");
// animategray 灰色
var animcolorno = mm("do_Animator");
var propscolorno = {
	bgColor : "E0E0E0FF"
};
animcolorno.append(120, propscolorno, "EaseIn");
// switch切换开关
var swbox = ui("switch_box");
var swbg = ui("switch_bg");
var swbtn = ui("switch_btn");
root.setMapping({
	"labelTitle.text" : "labelTitle"
});
var swbtnText1, swbtnText2;
root.on("switchzt", function(data) {
	swbox.tag = data[0];
	if (swbox.tag == 0) {
		swbtnText1 = data[1]
		swbtn.text = swbtnText1;
		swbtn.x = 7;
		swbtn.redraw();
		swbtn.fontColor = "888888ff";
		swbg.bgColor = "E0E0E0FF";
	} else {
		swbtnText2 = data[2]
		swbtn.text = swbtnText2;
		swbtn.x = 37;
		swbtn.redraw();
		swbtn.fontColor = "FF7E00FF";
		swbg.bgColor = "FF7E00FF";
	}
});
// 按下事件
swbox.on("touch", function() {
	if (swbg.bgColor == "E0E0E0FF") {
		swbox.tag = 1;
		swbtn.animate(animyes, function() {
			swbtn.text = swbtnText2;
		});
		swbg.animate(animcoloryes, function() {
			swbtn.fontColor = "FF7E00FF";
			swbg.bgColor = "FF7E00FF";
		});

	} else {
		swbox.tag = 0;
		swbtn.animate(animno, function() {
			swbtn.text = swbtnText1;
		});
		swbg.animate(animcolorno, function() {
			swbtn.fontColor = "888888ff";
			swbg.bgColor = "E0E0E0FF";
		});
	}
	root.fire("switchtag", swbox.tag);
});